package com.model;

// Generated 2013-8-25 14:56:38 by Hibernate Tools 3.6.0

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Relation generated by hbm2java
 */
@Entity
@Table(name = "relation")
public class Relation implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 672722668884692692L;
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	private Integer id;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id", nullable = false)
	private User userByUserId;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_by_id", nullable = false)
	private User userByUserById;

	@Column(name = "type", nullable = false)
	private int type;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_at", length = 19)
	private Date createAt;

	public Relation() {
	}

	public Relation(User userByUserId, User userByUserById, byte type) {
		this.userByUserId = userByUserId;
		this.userByUserById = userByUserById;
		this.type = type;
	}

	public Relation(User userByUserId, User userByUserById, byte type, Date createAt) {
		this.userByUserId = userByUserId;
		this.userByUserById = userByUserById;
		this.type = type;
		this.createAt = createAt;
	}

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public User getUserByUserId() {
		return this.userByUserId;
	}

	public void setUserByUserId(User userByUserId) {
		this.userByUserId = userByUserId;
	}

	public User getUserByUserById() {
		return this.userByUserById;
	}

	public void setUserByUserById(User userByUserById) {
		this.userByUserById = userByUserById;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public Date getCreateAt() {
		return this.createAt;
	}

	public void setCreateAt(Date createAt) {
		this.createAt = createAt;
	}

}
